package org.thanos.demo.model;

import java.util.List;

public class PageResult<T> {

    private long total;

    private List<T> result;

    private PageResult() {
        super();
    }

    private PageResult(long total, List<T> result) {
        this.total = total;
        this.result = result;
    }

    /**
     * 将PageHelper分页后的list转为分页信息
     */
    public static <T> PageResult<T> of(long total, List<T> list) {
        return new PageResult<>(total, list);
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public List<T> getResult() {
        return result;
    }

    public void setResult(List<T> result) {
        this.result = result;
    }

    @Override
    public String toString() {
        return "PageResult{" +
                "total=" + total +
                ", result=" + result +
                '}';
    }
}
